基础环境安装与使用
基础环境的安装与使用
目标
- 完成机器学习基础阶段的环境安装
- 学会使用jupyter notebook平台完成代码编写运行
库的安装
新建一个用于人工智能环境的虚拟环境
mkvirtualenv ai
matplotlib==2.2.2
numpy ==1.14.2
pandas==0.20.3
tables==3.4.2
jupyter==1.0.0
Jupyter Notebook使用
运行Jupyter notebook
cell操作
- 支持两种模式
- 命令模式
- 编辑模式
快捷键
两种模式通用快捷键
Shift + Enter
: 执行本单元代码,并跳转到下一单元Ctrl + Enter
: 执行本单元代码,留在本单元
命令模式:按ESC进入
Y
: cell切换到code模式M
:cell切换到Markdown模式A
:当前cell的上面添加cellB
: 当前cell的下面添加cell
其他:
双击D
:删除当前cellZ
: 回退L
: 为当前cell加上行号Ctrl + Shift + P
: 对话框输入命令直接运行Ctrl + Home
: 快速跳转到首个cellCtrl + End
: 快速跳转到最后一个cell
编辑模式
- 补全代码:变量、方法后跟
Tab键
- 为一行或多行添加/取消注释:
Ctrl + /
其他
- 多光标操作:
Ctrl点击鼠标
- 回退:
Ctrl + Z
- 重做:
Ctrl + Y
Jupyter notebook中自动补全代码等相关功能
安装jupyter_contrib_nbextensions库
python -m pip installl jupyter_contrib_nbextensions
然后执行
jupyter contrib nbextension install --user --skip-running-check
在原来的基础上勾选:“Table of Contents”以及Hinterland